
import javax.swing.*;

public class Cifre extends Responsabil{
    private JFrame f;
    Cifre(JFrame f){
        this.f = f;
    }
    public boolean test(String s){
        boolean rez = true;
        char c;
        for(int i = 0; i < s.length(); i++)
        {
            c = s.charAt(i);
            if((c=='1')||(c=='2')||(c=='3')||(c=='4')||(c=='5')||(c=='6')||(c=='7')||(c=='8')||(c=='9')||(c=='0')){
                rez = false;
                break;
            }
        }
        if(rez == false)
            mesaj(f);
        else{
            if(this.next != null)
                next.test(s);
        }
        return rez;
    }
    public void mesaj(JFrame f){
     JOptionPane.showMessageDialog(f, "Ati introdus un cuvant care contine cifre arabe", "Eroare", JOptionPane.ERROR_MESSAGE);
     System.exit(1);
    }

}

